package com.jiumao.model;
//类
public class Person {
    //属性
    private String firstName;
    private String lastName;
    private int age;
    private String mobilePhone;

    public Person(){

    }
    public Person(String name, int age, String mobilePhone) {
        this.firstName = name.substring(0,1);
        this.lastName = name.substring(1);
        this.age = age;
        this.mobilePhone = mobilePhone;
    }

    public boolean isElderThan(Person another){
        return another.getAge() < this.age;
    }
    public String getName(){
        return this.firstName +this.lastName;
    }

    public void setName(String name){
        this.firstName = name.substring(0,1);
        this.lastName = name.substring(1);
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    //行为
    public void isAdult(){
        if(this.age<18){
            System.out.println(this.getName() + "is not an adult");
        }else{
            System.out.println(this.getName() + "is  an adult");
        }
    }
}
